/*
 * author      : dormi330
 * date        : 2018/6/28
 * description : 健康检测接口
 */

package com.deep.trade.adaptor.provided.rest;

import com.deep.trade.application.exception.LayerControllerException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HealthzController {

    @ResponseBody
    @RequestMapping(value = "/api/v1/ruok", method = RequestMethod.GET)
    public String sayHello() {
        System.out.println("HelloController::sayHello");
        return "imok";
    }

    @ResponseBody
    @RequestMapping(value = "/api/v1/error1", method = RequestMethod.GET)
    public String error1() throws Exception {
        throw LayerControllerException.argumentNotFound("token");
    }

    @ResponseBody
    @RequestMapping(value = "/api/v1/error2", method = RequestMethod.GET)
    public String error2() throws Exception {
        throw LayerControllerException.argumentInvalid("page");
    }

}
